Make Your Own PuzzleScript Games! by Anna Anthropy

Make Your Own PuzzleScript Games! by Anna Anthropy

Author:Anna Anthropy
Language: eng
Format: epub
Publisher: No Starch Press
Published: 2020-03-13T16:00:00+00:00


Creating the Buddy Group for the Win Condition

Fortunately, we can use groups for the win condition too. Just like we made a pushable group to turn crates and sleeping robots into pushable objects, we can make a new group to make robots count as the same thing, whether they’re sleeping or awake. Let’s update the legend by adding the following line:

Player = Horibot or Vertibot Pushable = Crate or HoribotSleeping or VertibotSleeping Buddy = Player or HoribotSleeping or VertibotSleeping

Note that because Player already includes Horibot and Vertibot, we can just use Player to create a new group called Buddy that includes both robots. Now, whenever we refer to a Buddy, we’re referring to any robot in either state, asleep or awake.

Let’s update our WINCONDITIONS section using Buddy:

============== WINCONDITIONS ============== all Buddy on Exit

The code all Buddy refers to all Buddy objects currently in the level. If there’s only one robot in a level, all Buddy means just that one robot. If both robots are in the level, all Buddy means both of them. Because sleeping and awake robots count as Buddy objects, it doesn’t matter what state they’re in. As long as all the Buddy objects in the current level are on an Exit object, the win condition is satisfied.

One more thing! To make sure that both robots can fit on the exit, each level needs to have at least two Exit spaces. Add two Exit spaces to your level, as shown here:

====== LEVELS ====== ######### #.......# #.I...H.# #.......# #...*...# #X.....X# #########

You can either add two Xs to your LEVELS section code, or you could add the Exit spaces using the level editor (see Chapter 3 to review how to do this). Here’s what the updated level should like:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.